package com.example.spring.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.spring.demo.entity.UserMenu;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface UserMenuMapper extends BaseMapper<UserMenu> {
    // 保存菜单
    @Insert("""
<script>
insert into user_menu(user_id,menu_id) values
<foreach collection="menuIds" separator="," item="item" index="index">
        (#{userId},#{item})
</foreach>
</script>
""")
    boolean saveMenu(@Param("userId") Long userId, @Param("menuIds") List<Long> menuIds);
}
